import java.util.Random;
import java.util.Scanner;


public class TestDemo{


    public static void main6(String[] args) {
        int a = 24;
        int b = 18;
        int c = a % b;
        while (c != 0) {
            a = b;
            b = c;
            c = a % b;
        }
        System.out.println(b);
    }
    public static void main5(String[] args) {
    }
    public static void main4(String[] args) {
        //编写代码模拟三次密码输入的场景。 最多能输入三次密码，密码正确，
        // 提示“登录成功”,密码错误， 可以重新输 入，最多输入三次。三次均错，则提示退出程序
        Scanner scanner = new Scanner(System.in);
        int count = 3;
        while (count != 0){
            System.out.println("请输入密码,还有" + count + "机会");
            String str = scanner.nextLine();
            if (str.equals("123456")){
                System.out.println("恭喜你，输入密码成功");
                break;
            }else {
                System.out.println("密码输入失败");
                count--;
            }
        }
    }
    public static void main3(String[] args) {
        //123的每一位是3，2，1
        Scanner scanner = new Scanner(System.in);
        int ret = 0;
        int num = scanner.nextInt();
        while (true){
            if (num != 0) {
                ret = num % 10;
                System.out.println(ret);
                num = num / 10;
            }
            if (num == 0) {
                break;
            }
        }
    }
    public static void main2(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (true){
            int num = scanner.nextInt();
            for (int i = 0; i < num; i++) {
                for (int j = 0; j < num; j++) {
                    if (i == j || (i + j) == num - 1) {
                        System.out.print("*");
                    }else {
                        System.out.print(" ");
                    }
                }
                System.out.println();
            }
        }
    }
    /*public static void main(String[] args) {
        //实现猜数字游戏
        Random random = new Random();
        Scanner scanner = new Scanner(System.in);
        int ranNum = random.nextInt(101);
        while (true){
            System.out.println("请输入一个数字进行猜一猜");
            int sum = scanner.nextInt();
            if (sum == ranNum){
                System.out.println("恭喜你，猜对了");
                break;
            } else if (sum > ranNum) {
                System.out.println("猜大了，再来一次");
            }else {
                System.out.println("猜小了，再来一次");
            }
        }
    }*/
    public static void main1(String[] args) {
        //计算1/1-1/2+1/3-1/4+1/5 …… + 1/99 - 1/100 的值
        double sum = 0;
        double sum1 = 0;
        double sum2 = 0;
        for (int i = 1; i <= 100; i+=2) {
            sum1 += 1.0/i;
        }
        for (int j = 2; j <= 100 ; j+=2) {
            sum2 += 1.0/j;
        }
        sum = sum1 - sum2;
        System.out.println(sum);
    }

}
